package com.naiterui.ehp.bs.patient.dao.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.naiterui.ehp.bp.domain.DrCustomCharge;
import com.naiterui.ehp.bs.patient.dao.IDrCustomChargeDao;
import com.naiterui.ehp.bs.patient.repository.IApDrCustomChargeRepository;

/**
 * <P>功能描述 : 医生自定义服务收费DAO实现 </P>
 * <P>File name : DrCustomChargeDaoImpl </P>
 * <P>Author : 王泽浩 </P>
 * <P>E-Mail : 1028625100@qq.com </P>
 * <P>Date : 2017/3/30 上午10:51</P>
 */
@Component
public class ApDrCustomChargeDaoImpl implements IDrCustomChargeDao {

    @Autowired
    private IApDrCustomChargeRepository drCustomChargeRepository;

    /**
     * <P>功能描述 : 通过ID获取结果 </P>
     * <P>Method Name : get </P>
     * <P>Author : 王泽浩 </P>
     * <P>E-Mail : 1028625100@qq.com </P>
     * <P>Date : 2017-04-01 17:23:21</P>
     *
     * @param id 主键ID
     *
     * @return 个性化服务
     *
     * @since 2.7
     */
    @Override
    public DrCustomCharge get(long id) {
        return drCustomChargeRepository.get(id);
    }

    /**
     * <P>功能描述 :保存或者更新 </P>
     * <P>Method Name : saveOrUpdate </P>
     * <P>Author : 王泽浩 </P>
     * <P>E-Mail : 1028625100@qq.com </P>
     * <P>Date : 2017-04-08 12:01:51</P>
     *
     * @param customCharge 需要更新的自定义收费
     *
     * @since 2.7
     */
    @Override
    public void saveOrUpdate(DrCustomCharge customCharge) {
        customCharge.setChangedAt(new Date());
        customCharge.setChangedBy("system");
        drCustomChargeRepository.save(customCharge);
    }
}
